<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 例题
        function fn() {};
        fn.prototype.a = 100;
        var f1 = new fn();
        f1.a = 200;
        var f2 = new fn();
        fn.a = 300;
        console.log(fn.__proto__ === Function.prototype); //?? t
        console.log(fn.__proto__ === fn.prototype); //?? f
        console.log(f1.__proto__ === fn.prototype); //?? t
        console.log(f2.a);//??100

        // 例题
        var A = function() {};
        A.prototype.n = 1;
        var b = new A();
        console.log(b.__proto__ === A.prototype); //t

        A.prototype = { n: 2, m: 3 };//若屏蔽这句话，结果又是什么？ 1 undefined 1 undefined
        //A.prototype.m=3;//若屏蔽上边一行，并添加此行，结果又是什么？
        var c = new A();

        console.log(b.n, b.m, c.n, c.m); //?? 1 undefined 2 3
        console.log(b.__proto__ === c.__proto__);//??f
        console.log(b.__proto__ === A.prototype);//?? f b的__proto__什么时候和A.prototype断开的

        // 例题
        var F = function() {};
        Object.prototype.a = function() {
            console.log("a()");
        };
        Function.prototype.b = function() {
            console.log("b()");
        };

        var f = new F();
        f.a(); //??  f->F.protptype->Object.prototype---a()
        f.b(); //?? 能否正常输出 不能 f-> f.__proto__(F.protptype)->Object.prototype->null 无
        F.a(); //?? F->Function.prototype->Object.prototype---a()
        F.b(); //?? F->Function.prototype---b()

        var arr = [1,2,3,-5,-7];
        // Array.prototype.push;
        arr.push(4); //arr->Array.prototype
        
        arr.map(Math.abs);
        Array.prototype.map.call(arr,Math.abs);

    </script>
</body>
</html>